package com.itheima.health.dao;

import com.github.pagehelper.Page;
import com.itheima.health.pojo.Menu;
import com.itheima.health.pojo.Role;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 角色DAO
 */
public interface RoleDao {
    /**
     * 根据用户ID查询
     * @param userId
     * @return
     */
    List<Role> selectByUserId(@Param("userId") Integer userId);   List<Menu> selectByRoleId(@Param("roleId") Integer roleId);

    List<Role> selectAll();

    Page<Role> selectByCondition(@Param("queryString") String queryString);

    void insert(Role role);

    void update(Role role);

    Role selectById(@Param("id") Integer id);

    long countCheckPermissionByid(@Param("id") Integer id);

    void delete(@Param("id") Integer id);

    void insertRoleIdAndPermissionId(@Param("roleId") Integer roleId,@Param("permissionId") Integer permissionId);

    void insertMenuIdAndRoleId(@Param("roleId") Integer id,@Param("menuId") Integer menuId);

    List<Integer> selectRoleIdsByMenuId(@Param("id") Integer id);

    void deletePermissionIdByRoleId(@Param("id") Integer id);

    void deleteMenuIdsByRoleId(@Param("id") Integer id);

    long countPermissionIdRoleId(@Param("id") Integer id );

    long countMenuIdByRoleId(@Param("id") Integer id);
}
